window.addEvent('domready', function() {
	if($('a1')) {
		$('a1').className = 'invisible';
		$('a2').className = 'invisible';
		$('a3').className = 'invisible';
		$('a4').className = 'invisible';
		$('a5').className = 'invisible';
		$('a6').className = 'invisible';
		$('a7').className = 'invisible';
		$('a8').className = 'invisible';
						
		var type = $('q-type').value;
		if(type == 'RadioButton' || type == 'CheckBox' || type == 'Rate' || type == 'DropDown') {
			showAnswers();
		}
	}
	$('required').className ='invisible';
	$('create_section').className ='invisible';
	$('select_date').className ='invisible';
	$('select_day').className ='invisible';
	$('frequency').className ='invisible';
	$('date1').className ='invisible';
	$('date2').className ='invisible';
});

function showAnswers() {
	$('a1').className = '';
	$('a2').className = '';
	$('a3').className = '';
	$('a4').className = '';
	$('a5').className = '';
	$('a6').className = '';
	$('a7').className = '';
	$('a8').className = '';
}

function hideAnswers() {
	$('a1').className = 'invisible';
	$('a2').className = 'invisible';
	$('a3').className = 'invisible';
	$('a4').className = 'invisible';
	$('a5').className = 'invisible';
	$('a6').className = 'invisible';
	$('a7').className = 'invisible';
	$('a8').className = 'invisible';
}

function showFrequency(){
	$('frequency').className ='';
	$('select_date').className ='invisible';
	$('select_day').className ='invisible';
	$('date1').className ='invisible';
	$('date2').className ='invisible';
}

function showDate(){
	$('select_date').className ='';
	$('frequency').className ='';
	$('select_day').className ='invisible';
	$('date1').className ='invisible';
	$('date2').className ='invisible';
}

function showDay(){
	$('select_day').className ='';
	$('frequency').className ='';
	$('select_date').className ='invisible';
	$('date1').className ='invisible';
	$('date2').className ='invisible';
	
}

function showFixedDate(){
	$('date1').className ='';
	$('date2').className ='';
	$('select_date').className ='invisible';
	$('select_day').className ='invisible';
	$('frequency').className ='invisible';
	
}

function showRequired(){
	$('required').className ='';
	$('create_section').className ='invisible';
	
}

function showSection(){
	$('required').className ='invisible';
	$('create_section').className ='';
	
}

function checkAll(num){
    for(var i=1;i<num+1;i++){
	var check_box = 'check_'+i;
	if($(check_box)){
	 $(check_box).checked ='checked';
		}
	if($(check_box) && $('check_all').checked==''){
			 $(check_box).checked ='';	
	}		
}
}    

function uncheckAll(num){
	for(var i=1;i<num+1;i++){
		var check_box = 'check_'+i;
		if($(check_box) ){
		 $(check_box).checked ='';
			}
		}	
}